package com.fulu.javabase.proxy.dynamicproxy;

import com.fulu.javabase.proxy.entity.User;
import com.fulu.javabase.proxy.service.UserService;
import com.fulu.javabase.proxy.service.UserServiceImpl;

public class DynamicProxyTest {
    public static void main(String[] args) {
        LogHandler logHandler = new LogHandler();
        UserService userService = (UserService) logHandler.getNewInstance(new UserServiceImpl());
        userService.add(new User());

        CglibProxy cglibProxy = new CglibProxy();
        UserService proxyInstance = (UserService) cglibProxy.createProxyInstance(UserServiceImpl.class);
        proxyInstance.add(new User());
    }
}
